const fs = require("fs");


const obj = {
  readFile: (url) => {
    return new Promise((resolve, reject) => {
      fs.readFile(url, "utf-8", (err, data) => {
        if (err) {
          reject(err)
        } else {
          resolve(data)
        }
      })
    })
  },
  
  writeFile: (url, content) => {
    return new Promise((resolve, reject) => {
      fs.writeFile(url, content, (err) => {
        if (err) {
          reject(err)
        } else {
          resolve()
        }
      })
    })
  }
}


// module.exports = {readFile, writeFile};
module.exports = obj;